package com.taoz.rpc.core.registry;

import com.taoz.rpc.core.config.ApplicationConfig;
import com.taoz.rpc.core.spi.SpiLoader;

public class RegistryFactory {
    static {
        SpiLoader.load(Registry.class);
    }

    public static Registry getRegistry(String className) throws InstantiationException, IllegalAccessException {
        return (Registry) SpiLoader.getInstance(className);
    }

    public static Registry getRegistry() throws InstantiationException, IllegalAccessException {
        String className = ApplicationConfig.getConfig().getRegistryName();
        return (Registry) SpiLoader.getInstance(className);
    }
}
